<template>
  <div class="loading-container">
    <a-spin size="large" tip="恢复登录中 . . ."></a-spin>
  </div>
</template>

<script>
export default {
  created() {
    // 监控登录状态
    this.unWatch = this.$watch(
      () => this.$store.getters['loginInfo/status'],
      (status) => {
        if (status !== 'checking') {
          this.$router.push({
            name: this.$route.query.target || 'home',
          }).catch(() => {});
        }
      },
      {
        immediate: true,
      },
    );
  },
  destroyed() {
    // 取消监控
    this.unWatch();
  },
};
</script>

<style scoped>
.loading-container{
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/deep/ .ant-spin-text{
  margin-top: 20px;
}
</style>
